package com.wsg.dep.queue;

import com.wsg.dep.core.event.EventFactory;
import com.wsg.dep.queue.seq.Seq;

/**
 * @className: RwDemo
 * @author: 承泽
 * @date: 2025/3/20 17:11
 * @description:
 */
public class RwDemo {

    public static void main(String[] args) {
        solelyDictate();
    }

    /**
     * 乾纲独断
     * 读和写都由自己亲历亲为
     */
    public static void solelyDictate() {

        // 定义一个基本的数据类型（由事件工厂生产对应的数据类型）
        EventFactory<SleepEvent> factory = new EventFactory<SleepEvent>() {
            @Override
            public SleepEvent newInstance() {
                return new SleepEvent();
            }
        };






        int bufferSize = 2 << 0;

        BaseRingQueue<SleepEvent> queue = new BaseRingQueue<SleepEvent>(factory, bufferSize);

        // 当前发布数的游标
        Seq currentPubIndex = new Seq();

        long l = currentPubIndex.incrementAndGet();
        SleepEvent sleepEvent = queue.get(l);
        long value = sleepEvent.getValue();



    }
}
